live re-theme for auto - #2530
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
chaitanyapotti
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Jira Link
Description
When
uiConfig.modeis set to"auto", the Web3Auth modal now follows live OS color-scheme changes. Previously the theme was resolved once from theisDarkprop, so switching the OS between light and dark mid-session left the open modal on the stale theme. The modal now re-themes instantly without needing to be closed and reopened.Changes
WidgetContext(packages/modal/src/ui/context/WidgetContext.tsx)isDarkprop toisDarkPropand derive the effectiveisDarkfrom local state, seeded fromprefers-color-schemewhenmode === "auto"(falling back to the prop otherwise).matchMedia("(prefers-color-scheme: dark)")listener (active only in"auto"mode) that updates the React context value on OS theme changes.w3a--darkvariant on#w3a-parent-containerin sync with the context value so component styling and context state stay aligned.window/matchMediaaccess for SSR safety and cleaned up the listener on unmount / mode change.How has this been tested?
Screenshots (if appropriate)
Screen.Recording.2026-07-21.at.11.26.18.PM.mov
Types of changes
Checklist
Note
Low Risk
Scoped UI/theming in WidgetContext with SSR guards; no auth, data, or API changes.
Overview
When
uiConfig.modeis"auto", the modal no longer sticks to the theme resolved once from the parentisDarkprop.WidgetProvidernow keepsisDarkin React state (initialized fromprefers-color-schemewhen possible) and subscribes tomatchMedia("(prefers-color-scheme: dark)")so an open modal updates light/dark as the OS scheme changes.On each scheme change it also toggles
w3a--darkon#w3a-parent-container, aligning Tailwind’s dark variant with context (e.g.appLogo).window/matchMediausage is guarded for SSR, and the listener is removed when mode is not auto or on unmount.Reviewed by Cursor Bugbot for commit e66ad1d. Bugbot is set up for automated code reviews on this repo. Configure here.